<extend name="Layout/page_detail" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
{:W('PageHeader/search',array('name'=>'党员情况管理','search'=>'S'))}
	<form method="post" id="form_adv_search" name="form_adv_search" method="post">
		<input type="hidden" name="ajax" id="ajax" value="1">
		<div class="operate panel panel-default">
			<div class="panel-body">
				<div class="pull-left">
				</div>
				<div class="pull-right">
					<a onclick="add()"  class="btn btn-sm btn-primary">新增</a>
					<a onclick="save()"  class="btn btn-sm btn-primary">保存</a>
					|
					<a onclick="del()"  class="btn btn-sm btn-danger">删除</a>
				</div>
			</div>
		</div>
	</form>
	<div class="row">
		<div class="col-sm-4 sub_left_menu ">
			<table class="table table-bordered">
				<thead>
					<tr>
						<th>姓名</th>
						<th>工作单位</th>
						<th>入党时间</th>
					</tr>
				</thead>
				<tbody>
                <volist name="list" id="data">
						<tr id="{$data.id}">
							<td> {$data.name}</td>
							<td> {$data.work_company}</td>
							<td> {$data.partydate}</td>
						</tr>
                </volist>
				</tbody>
			</table>
			<div class="pagination">
                {$page}
			</div>
		</div>
		<div class="col-sm-8">
			<form id="form_data" name="form_data" method="post" class="form-horizontal">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="opmode" id="opmode" value="edit">
            
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="name">姓名*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="name" name="name" class="form-control" check="require">
                    </div>
                </div>                                                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="sex">性别*：</label>
                    <div class="col-sm-8">
                        <select name="sex" id="sex" class="form-control" msg="请选择" check="require">
                        <option value="">请选择</option>
                        
						<option value="0">男</option>
						<option value="1">女</option>                        
					</select>
                    </div>
                </div>                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="nation">民族*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="nation" name="nation" class="form-control" check="require">
                    </div>
                </div>                                                                                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="borndate">出生日期*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="borndate" name="borndate" class="form-control input-date" check="require">
                    </div>
                </div>                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="hometown">籍贯*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="hometown" name="hometown" class="form-control" check="require">
                    </div>
                </div>                                                                                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="partydate">入党时间*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="partydate" name="partydate" class="form-control input-date" check="require">
                    </div>
                </div>                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="education_grade_id">学历*：</label>
                    <div class="col-sm-8">
                        <select name="education_grade_id" id="education_grade_id" class="form-control" msg="请选择" check="require">
                        <option value="">请选择</option>
                        {:fill_option($education_grade_list)}
                        </select>
                    </div>
                </div>                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="graduate_school">毕业院校：</label>
                    <div class="col-sm-8">
                        <input type="text" id="graduate_school" name="graduate_school" class="form-control" >
                    </div>
                </div>                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="idcard_num">身份证号*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="idcard_num" name="idcard_num" class="form-control" check="require">
                    </div>
                </div>                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="work_phone">办公电话：</label>
                    <div class="col-sm-8">
                        <input type="text" id="work_phone" name="work_phone" class="form-control" >
                    </div>
                </div>                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="mobile_phone">移动电话*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="mobile_phone" name="mobile_phone" class="form-control" check="require">
                    </div>
                </div>                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="work_company">工作单位*：</label>
                    <div class="col-sm-8">
                        <input type="text" id="work_company" name="work_company" class="form-control" check="require">
                    </div>
                </div>                                                                                
			<div class="form-group  col-sm-6">
                    <label class="col-sm-4 control-label" for="home_address">家庭住址：</label>
                    <div class="col-sm-8">
                        <input type="text" id="home_address" name="home_address" class="form-control" >
                    </div>
                </div>                                                                                                
			<div class="clearfix"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="special">专业特长：</label>
                        <div class="col-sm-10">
                            <textarea  class="editor" id="special" name="special" style="width:100%;height:200px;" ></textarea>
                        </div>
                    </div>                                                                                <div class="form-group">

                </div>
			</form>

		</div>

	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function add() {
			$("#opmode").val("add");
			$("#id").val("");
			if (check_form("form_data")) {
            sendForm("form_data", "{:U('save')}", "__SELF__");
			}
		};

		function del() {
			var vars = $("#form_data").serialize();
			ui_confirm('确定要删除吗?', function() {
                sendAjax("{:U('del')}", vars, function(data) { 
					if (data.status) {
						ui_alert(data.info, function() {
							location.reload(true);
						});
					}
				});
			});
		}


		function save() {
			if (check_form("form_data")) {
            sendForm("form_data", "{:U('save')}"); 
			}
		}

		function showdata(result) {
			$("#form_data select ").each(function() {
                $(this).find('option').attr('selected', null);
			});
			for (var s in result.data) {
				set_val(s, result.data[s]);
			}
			$("#opmode").val("edit");
		}


		$(document).ready(function() {
			set_return_url();
			$(".sub_left_menu tbody tr").click(function() {
				$(".sub_left_menu tbody tr.active").removeClass("active");
				$(this).attr("class", "active");
                sendAjax("{:U('read')}", "id=" + $(this).attr("id"), function(data) { 
					showdata(data);
				});
				return false;
			});
		});

	</script>
</block>